menuList[6].onclick();


//开始修改信息 
function openChangeFun(){
    let input  = document.querySelectorAll("input");
    for(let  i=0;i<input.length;i++){
        input[i].style.border="1px solid #ccc"
    }
}
// 修改信息
function changeFun(e){
    e=e || window.event;
    var target=e.target || e.srcElement;
    let personDataFrom = document.getElementById("personDataFrom")
    let formMsg = serialize(personDataFrom);
    console.log(formMsg);
    let userid= target.getAttribute("name");
    console.log(target);
    let flagid = document.getElementsByClassName("flagid")[0]
    console.log(flagid);
    if(formMsg.email.length==0||formMsg.sex.length==0||formMsg.telephone.length==0||formMsg.nickname.length==0){
        explain({
            code:3,
            msg:"请见检查信息是否填写完整",
            time:3000
        })
    }else{
        axios({
            url:'/admin/users/updateAVip',
            method:'POST',
            params:{
                email: email.value,
                // password:formMsg.password[0],
                // birth:selYear.value+"-"+ selMonth.value + "-" + selDay.value ,
                sex:formMsg.sex[0]==0?"男":"女",
                telephone:formMsg.telephone[0],
                nickname:formMsg.nickname[0],
                flag:flagid.getAttribute("name"),
                userId:userid
                }
            })
            .then(data => {
                console.log(data);
                if(data.data.code==20000){
                    explain({
                        code:1,
                        msg:"修改成功",
                        time:3000
                    })
                    // location.href = "/home/login"
                }else{
                    explain({
                        code:2,
                        msg:data.data.data,
                        time:3000
                    })
                }
            })
            .catch(err => {
                console.log(err);
            })
    }
}

function initFun() {
    let personDataFrom = document.getElementById("personDataFrom")
    let male =document.getElementById("male")
    let female =document.getElementById("female")
    if(personDataFrom.getAttribute("name")=="男"){
        male.setAttribute("checked","checked")
    }else{
        female.setAttribute("checked","checked")
    }
}
initFun()